﻿using System.Collections.Generic;

namespace GT
{
    public static partial class Extensions
    {
        public static int AddUnique<T>(this IList<T> list, T item)
        {
            if (list.Contains(item))
                return list.IndexOf(item);

            int ret = 0;
            lock (new object())
            {
                ret = list.Count;
                list.Add(item);
            }
            return ret;
        }
    }
}
